<include file="public:header" />
    <div class="toptip">
        <h2>提示：</h2>
        <p>系统默认分类不能删除！<br />删除顶级级分类将会自动删除此分类下的子分类。</p>
    </div>
    <form id="form1" name="form1" method="post" action="{:U('ArticleCategory/delete')}">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" id="list" class="link_lan"  >
        <tr>
          <td height="26" class="admin_list_tit admin_list_first" >
          <label id="categorychkAll"><input type="checkbox" name=" " title="全选/反选" id="chk"/>分类标题</label></td>
          <td width="160"   align="center"  class="admin_list_tit">类型</td>
          <td width="160"   align="center"  class="admin_list_tit">排序</td>
          <td width="200"   align="center" class="admin_list_tit">操作</td>
        </tr>
        <volist name="list" id="list">
          <tr>
            <td class="admin_list admin_list_first" >
              <input type="checkbox" name="id[]" value="{$list.id}" id="{$list.id}"  class="Bcheck"/>
              <img src="__ADMINPUBLIC__/images/b_left_d.gif" border="0" align="absmiddle"  id="{$list.id}" class="Bclass"/>
              <strong>{$list.categoryname}</strong>
              <span style="color:#CCCCCC">(id:{$list.id})</span>
            </td>
            <td align="center"  class="admin_list">
              <if condition="$list['admin_set'] eq 1">
                系统分类
              <else/>
                自定义分类
              </if>
            </td>
            <td align="center"  class="admin_list">
              {$list.category_order}
            </td>
            <td class="admin_list">
              <a href="{:U('ArticleCategory/add',array('id'=>$list['id']))}">此类下添加子类</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="{:U('ArticleCategory/edit',array('id'=>$list['id']))}">修改</a>&nbsp;&nbsp;
              <if condition="$list['admin_set'] neq 1">
              |&nbsp;&nbsp;<a onclick="return confirm('你确定要删除吗？')" href="{:U('ArticleCategory/delete',array('id'=>$list['id']))}">删除</a>
              </if>
            </td>
          </tr>
          <volist name="list['sub']" id="sub">
            <tr class="Sclass_{$list.id}"  >
              <td  class="admin_list"  style="padding-left:31px;">
                <input type="checkbox" name="id[]" value="{$sub.id}" class="Scheck_{$list.id}"/>
                {$sub.categoryname}
                <span style="color: #CCCCCC">(id:{$sub.id})</span>
              </td>
              <td align="center"  class="admin_list">
                <if condition="$sub['admin_set'] eq 1">
                系统分类
                <else/>
                  自定义分类
                </if>
              </td>
              <td align="center"  class="admin_list">
                {$sub.category_order}
              </td>
              <td class="admin_list" style="padding-left:100px;">
                <a href="{:U('ArticleCategory/edit',array('id'=>$sub['id']))}">修改</a>&nbsp;&nbsp;
                <if condition="$sub['admin_set'] neq 1">
                |&nbsp;&nbsp;<a onclick="return confirm('你确定要删除吗？')" href="{:U('ArticleCategory/delete',array('id'=>$sub['id']))}">删除</a>
                </if>
              </td>
            </tr>
          </volist>
        </volist>
      </table>
      <table width="100%" border="0" cellspacing="10"  class="admin_list_btm">
          <tr>
              <td>
              <input name="ButADD" type="button" class="admin_submit" id="ButADD" value="添加分类"  onclick="window.location='{:U('ArticleCategory/add')}'"/>
              <input name="ButDel" type="submit" class="admin_submit" id="ButDel"  value="删除所选" onclick="return confirm('你确定要删除吗？')"/>
              </td>
              <td width="305" align="right"></td>
          </tr>
      </table>
  </form>
</div>
<include file="public:footer" />
<script type="text/javascript">
    $(document).ready(function()
    {
        $(".Bclass").click(function()
        {
            $(".Sclass_"+$(this).attr("id")).toggle();
            if ($(".Sclass_"+$(this).attr("id")).css("display")=="none")
            {
            $(this).attr("src","__ADMINPUBLIC__/images/b_left_e.gif");
            }
            else
            {
            $(this).attr("src","__ADMINPUBLIC__/images/b_left_d.gif");
            }
        });
        //全选
        $('#categorychkAll').click(function(){
          $("#form1 :checkbox").attr('checked',$("#chk").attr('checked'))
        });
        //设置可写权限
        $(".Bcheck,#categorychkAll").click(function()
        {
        setcheck();
        });
        function setcheck()
        {
            $(".Bcheck").each(function(i){      
                if ($(this).attr("checked"))
                {
                $(".Scheck_"+$(this).attr("id")).attr("checked","true");
                }
                else
                {
                  $(".Scheck_"+$(this).attr("id")).removeAttr("checked");
                }
            });
        }
    });
</script>
</body>
</html>